package StudyCode.summary.zipfile;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class UnbufferedIOSupportInTheFilesClass {
	public static void main(String[] args) {
		try {
			Path file = Paths.get("E:/Copy/2.txt");
			Path newFile = Paths.get("E:/Copy/4.txt");
			try (InputStream in = Files.newInputStream(file);
			     OutputStream out = Files.newOutputStream(newFile, StandardOpenOption.CREATE, StandardOpenOption.APPEND)) {
				int data = in.read();
				while (data != -1) {
					out.write(data);
					data = in.read();
				}
				System.out.println("Files类中的未缓冲复制文件成功");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}

	}
}
